<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
	<ui:composition template="/protegido/main.xhtml">
		<ui:define name='conteudoPrincipal'>
			<link rel="stylesheet"
				href="#{request.contextPath}/resources/stylesheets/layout.css"
				type="text/css" media="screen" />
			<script
				src="#{request.contextPath}/resources/javascripts/hideshow.js"></script>
			<script
				src="#{request.contextPath}/resources/javascripts/jquery.tablesorter.min.js"></script>
			<script
				src="#{request.contextPath}/resources/javascripts/jquery.equalHeight.js"></script>
			<script type="text/javascript">
				$(document).ready(function() {
					$(".tablesorter").tablesorter();
				});
				$(document).ready(function() {

					//When page loads...
					$(".tab_content").hide(); //Hide all content
					$("ul.tabs li:first").addClass("active").show(); //Activate first tab
					$(".tab_content:first").show(); //Show first tab content

					//On Click Event
					$("ul.tabs li").click(function() {

						$("ul.tabs li").removeClass("active"); //Remove any "active" class
						$(this).addClass("active"); //Add "active" class to selected tab
						$(".tab_content").hide(); //Hide all tab content

						var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
						$(activeTab).fadeIn(); //Fade in the active ID content
						return false;
					});

				});
			</script>
			<script type="text/javascript">
				$(function() {
					$('.column').equalHeight();
				});
			</script>
			<script type="text/javascript" charset="utf-8">
				$(document).ready(
						function() {
							$("#navigation li.disciplinasProf a").addClass(
									"active");
							$("#navigation li").parent().find('li')
									.removeClass("active");
							if ($("#disciplinasProf")) {
								$("#disciplinasProf").addClass("active");
							}

							$(".alunoMatriculas").find("div").hide().find(
									"div table").hide();
							$("a.matriculasAluno").click(
									function(event) {
										event.stopPropagation();
										var $target = $(event.target);
										if ($target.closest("td").hasClass(
												"alunoMatriculas")) {
											$target.slideUp(80);
										} else {
											$target.closest("tr").next().find(
													"div").slideToggle(70);
										}
										document.getElementById(
												"matriculasForm").reset();
									});
						});
			</script>

			<style type="text/css">
#duas-colunas {
	magin-bottom: 50px;
	min-height: 50px;
}

#duas-colunas .esq {
	float: left;
}

#duas-colunas .dir {
	float: left;
	margin-left: 25px;
}

#duas-colunas .botao {
	float: left;
	margin-left: 25px;
	padding-top: 13px;
}

input {
	width: 180px;
}
</style>
			<h2 style="margin-bottom: 0px;">#{disciplinaMB.disciplina.nome}
				#{disciplinaMB.disciplina.semestre}</h2>
			<article class="module width_full">
				<header>

					<ul class="tabs">
						<li class="active" style=""><a href="#tab1">Materiais de
								Aula</a></li>
						<li><a href="#tab2">Provas</a></li>
						<li><a href="#tab3">Atividades</a></li>
						<li><a href="#tab4">Fórum de Discussão</a></li>

					</ul>
				</header>

				<div class="tab_container">
					<div id="tab1" class="tab_content" style="display: block;">
						<h:form prependId="false">
							<table class="tablesorter" style="margin-top:-20px;">
								<thead>
									<tr>
										<th class="header">Descrição</th>
										<th class="header">Tipo Arq.</th>
										<th class="header">Data Cadastro</th>
										<th class="header">Ações</th>
									</tr>
								</thead>
								<tbody>
									<c:choose>
										<c:when test=">#{disciplinaMB.disciplina.conteudos.size() > 0}">
											<c:forEach items="#{disciplinaMB.disciplina.conteudos}" var="dc">
												<tr>
													<td scope="col"><h:commandLink value="#{dc.descricao}"
															action="#{disciplinaMB.editarDisciplina(dc.id)}" /></td>
													<td scope="col"><h:outputText
															value="#{dc.tipo}" /></td>
													<td scope="col"><h:outputText value="#{dc.dtCad}" /></td>
													<td scope="col"><h:commandLink value=" "
															title="Editar" styleClass="editButton"
															action="#{disciplinaMB.editarDisciplina(d.id)}" /> <h:commandLink
															value=" " title="Deletar" styleClass="removeButton"
															action="#{disciplinaMB.doExcluir(d.id)}" /></td>
												</tr>
											</c:forEach>
										</c:when>
										<c:otherwise>
											<br />
											<tr>
												<td colspan="4">Nenhum material encontrado.<br />

												</td>
											</tr>
										</c:otherwise>
									</c:choose>
								</tbody>

									<tr>
										<th colspan="1" style="text-align: left;"><h:link
												value="Compartilhar novo material"
												outcome="/protegido/prof/conteudo/novo.xhtml" /></th>
										<th colspan="5" style="text-align: right;">#{disciplinaMB.disciplina.conteudos.size()}
											material(s) encontrado(s).</th>
									</tr>
							</table>
						</h:form>
					</div>
					<!-- end of #tab1 -->

					<div id="tab2" class="tab_content" style="display: none;">
						<h:form prependId="false">
							<table class="tablesorter" style="margin-top:-5px;">
								<thead>
									<tr>
										<th class="header">Descrição</th>
										<th class="header">Data Início</th>
										<th class="header">Data Fim</th>
										<th class="header">Status</th>
										<th class="header">Ações</th>
									</tr>
								</thead>
								<tbody>
									<c:choose>
										<c:when test="#{disciplinaMB.provasDisciplina.size() > 0}">
											<c:forEach items="#{disciplinaMB.provasDisciplina}" var="dp">
												<tr>
													<td scope="col">
														<h:commandLink value="#{dp.descricao}"	action="#{provaMB.editarProva(dp.id)}" />
													</td>
													<td scope="col">
														<h:outputText value="#{dp.dtAbertura}" />
													</td>
													<td scope="col">
														<h:outputText value="#{dp.dtEncerramento}" />
													</td>
													<td scope="col">
														<h:outputText value="#{(dp.status) ? 'Aberta' : 'Fechada'}" />
													</td>
													<td scope="col"><h:commandLink value=" "
															title="Editar" styleClass="editButton"
															action="#{provaMB.editarProva(dp.id)}" /> <h:commandLink
															value=" " title="Deletar" styleClass="removeButton"
															action="#{provaMB.doExcluir(dp.id)}" /></td>
												</tr>
											</c:forEach>
										</c:when>
										<c:otherwise>
											<br />
											<tr>
												<td colspan="4">Nenhuma prova encontrada.<br />

												</td>
											</tr>
										</c:otherwise>
									</c:choose>
									
								</tbody>
								<tr>
										<th colspan="1" style="text-align: left;"><h:link
												value="Cadastrar nova prova"
												outcome="/protegido/prof/prova/novo.xhtml" /></th>
										<th colspan="5" style="text-align: right;">#{disciplinaMB.provasDisciplina.size()}
											prova(s) encontrada(s).</th>
									</tr>
							</table>
						</h:form>					
					
					
					</div>
					<div id="tab3" class="tab_content" style="display: block;"></div>
					<div id="tab4" class="tab_content" style="display: block;"></div>


				</div>


			</article>
		</ui:define>
	</ui:composition>
</h:body>
</html>